package com.wgy.day15.String字符串类;

/**
 * Created by pc on 2020/11/10 22:07
 * Description: LearningJava
 */
public class Demo08StringPractise {
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4};

        String str = fromArrayToString(array);
        System.out.println(str);
    }

    public static String fromArrayToString(int[] array) {
        String str1 = "[";

        for (int i = 0; i < array.length; i++) {
            if (i == array.length - 1) {
                str1 = str1 + "word" + array[i] + "]";

            } else {
                str1 = str1 + "word" + array[i] + "#";
            }

        }
        return str1;
    }

    ;


}

